home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr47 / wasm223.zip / PROMPT.ASM < prev    next >
Assembly Source File  |  1993-05-04  |  3KB  |  109 lines

  1. ;*********************************;
  2. ; WASM Prompting Module           ;
  3. ; By Eric Tauck                   ;
  4. ;                                 ;
  5. ; Defines:                        ;
  6. ;                                 ;
  7. ;   ProWrt  display prompt        ;
  8. ;   ProVer  display verify prompt ;
  9. ;   ProEsc  display escape prompt ;
  10. ;                                 ;
  11. ; Requires:                       ;
  12. ;                                 ;
  13. ;   VIDEO4.ASM                    ;
  14. ;   VIDEO5.ASM                    ;
  15. ;*********************************;
  16.  
  17.         jmps    _prompt_end
  18.  
  19. _prom_ver       DB      ' (Y/N)? ',0
  20. _prom_esc       DB      ';  Press <ESC>',0
  21.  
  22. ;========================================
  23. ; Display a two part prompt.
  24. ;
  25. ; In: AX= first prompt string; BX=
  26. ;     second prompt string (possibly
  27. ;     NULL); CL= width.
  28. ;
  29. ; Out: AL= spaces after prompts.
  30.  
  31. _ProTwo PROC    NEAR
  32.         push    di
  33.         push    cx
  34.  
  35. ;--- first string
  36.  
  37.         push    bx
  38.         call    WrtStr          ;display first prompt
  39.         mov     di, cx
  40.         call    CurAdv          ;advance cursor
  41.         pop     ax
  42.  
  43. ;--- second string
  44.  
  45.         or      ax, ax          ;check if second prompt
  46.         jz      _potwo1         ;skip if not
  47.  
  48.         call    WrtStr          ;display second prompt
  49.         push    cx
  50.         call    CurAdv          ;advance cursor
  51.         pop     ax
  52.  
  53. _potwo1 add     ax, di          ;total characters displayed
  54.         pop     cx              ;restore width
  55.         sub     dx, dx
  56.         sub     cl, al          ;spaces on end
  57.         jbe     _potwo2         ;exit if none
  58.  
  59.         push    cx
  60.         mov     al, ' '         ;space
  61.         call    WrtChrs         ;display
  62.         pop     dx
  63.  
  64. _potwo2 mov     ax, dx
  65.         pop     di
  66.         ret
  67.         ENDP
  68.  
  69. ;========================================
  70. ; Display a prompt.
  71. ;
  72. ; In: AX= prompt string; CL= width.
  73. ;
  74. ; Out: AL= spaces after prompt.
  75.  
  76. ProWrt  PROC    NEAR
  77.         sub     bx, bx
  78.         call    _ProTwo
  79.         ret
  80.         ENDP
  81.  
  82. ;========================================
  83. ; Display a verify prompt.
  84. ;
  85. ; In: AX= prompt string; CL= width.
  86. ;
  87. ; Out: AL= spaces after prompt.
  88.  
  89. ProVer  PROC    NEAR
  90.         mov     bx, OFFSET _prom_ver
  91.         call    _ProTwo
  92.         ret
  93.         ENDP
  94.  
  95. ;========================================
  96. ; Display an ESC prompt.
  97. ;
  98. ; In: AX= prompt string; CL= width.
  99. ;
  100. ; Out: AL= spaces after prompt.
  101.  
  102. ProEsc  PROC    NEAR
  103.         mov     bx, OFFSET _prom_esc
  104.         call    _ProTwo
  105.         ret
  106.         ENDP
  107.  
  108. _prompt_end
  109.